﻿//using Abp.AspNetCore.Mvc.Authorization;
//using Abp.Auditing;
//using Abp.Domain.Uow;
//using Abp.Json;
//using Microsoft.AspNetCore.Mvc;
//using Mt.Site.Application.WorkFlows;
//using Mt.Site.Application.WorkFlows.Dto.wf;
//using Mt.Site.Core.Base.Authorization.Users;
//using System;
//using System.Collections.Generic;
//using System.Linq;
//using System.Text;
//using System.Threading.Tasks;

//namespace Mt.Site.Web.Controllers
//{
//    public class WorkFlowController : MtSiteControllerBase
//    {
//        private readonly UserManager _userManager;
//        private readonly IWorkFlowQueryAppService _workFlowQueryAppService;

//        public WorkFlowController(UserManager userManager, IWorkFlowQueryAppService workFlowQueryAppService)
//        {
//            _userManager = userManager;
//            _workFlowQueryAppService = workFlowQueryAppService;
//        }

//        [AbpMvcAuthorize]
//        [DisableAuditing]
//        public ActionResult Print(Guid paperId, int archived)
//        {
//            ViewBag.paperId = paperId;
//            ViewBag.archived = archived;
//            return View();
//        }

//        [AbpMvcAuthorize]
//        [DisableAuditing]
//        public ActionResult BjPrint(Guid paperId, int archived)
//        {
//            ViewBag.paperId = paperId;
//            ViewBag.archived = archived;
//            return View();
//        }
//        [AbpMvcAuthorize]
//        [DisableAuditing]
//        public ActionResult YjPrint(Guid paperId, int archived)
//        {
//            ViewBag.paperId = paperId;
//            ViewBag.archived = archived;
//            return View();
//        }

//        [UnitOfWork]
//        [IgnoreAntiforgeryToken]
//        [DisableAuditing]
//        public async Task<ContentResult> GetDbList(string userName, string key)
//        {

//            if (key == "dfdfdg88kl19")
//            {
//                var user = _userManager.Users.FirstOrDefault(item => item.Name == userName && item.IsActive);
//                if (user != null)
//                {
//                    var userId = user.Id;

//                    using (AbpSession.Use(1, userId))
//                    {
//                        var pagedPaperInput = new PagedPaperInput 
//                        {
//                            WfQueryType = WorkFlowQueryType.Todo,
//                            SkipCount=0,
//                            MaxResultCount= 3,
//                            InclusiveWorkFlowId = new List<Guid> { 
//                                Guid.Parse("a2282fe3-171e-4227-37b4-08d84342fbe6"), 
//                                Guid.Parse("9a62f038-4bfe-4d9b-37b3-08d84342fbe6") 
//                            }
//                        };

//                        //待办
//                        var result = await _workFlowQueryAppService.GetPagedPapers(pagedPaperInput);

//                        //var pagedPaperInput2 = new PagedPaperInput
//                        //{
//                        //    WfQueryType = WorkFlowQueryType.ToRead,
//                        //    SkipCount = 0,
//                        //    MaxResultCount = 3,
//                        //    InclusiveWorkFlowId = new List<Guid> {
//                        //        Guid.Parse("a2282fe3-171e-4227-37b4-08d84342fbe6"),
//                        //        Guid.Parse("9a62f038-4bfe-4d9b-37b3-08d84342fbe6")
//                        //    }
//                        // };
//                        ////待阅
//                        //var result2 = await _workFlowQueryAppService.GetPagedPapers(pagedPaperInput2);

//                        //人事待办
//                        pagedPaperInput.InclusiveWorkFlowId = new List<Guid> {
//                            Guid.Parse("e1498eb2-4443-4cfa-7a3b-08d7ff8a567b"), 
//                            Guid.Parse("d153f589-699e-4f52-7a3a-08d7ff8a567b"),
//                            Guid.Parse("2d656f15-c56c-457e-7a39-08d7ff8a567b") };
//                        var result3 = await _workFlowQueryAppService.GetPagedPapers(pagedPaperInput);

//                        var json = new { State = true, TodoData = result, /*Preview = result2,*/ HrData = result3 };

//                        return Content(" var newOaJson = "+ json.ToJsonString() +"; showNewOaData();", "application/x-javascript", Encoding.UTF8);
//                    }
//                }
//            }
//            return Content(" var newOaJson = " + (new { State = false }).ToJsonString() + "; showNewOaData();","application/x-javascript", Encoding.UTF8);
//        }
//    }
//}